home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
snip9707.zip
/
ISPOW2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1997-07-05
|
326b
|
23 lines
/* +++Date last modified: 05-Jul-1997 */
#include <stdio.h>
#include "snipmath.h"
int ispow2(int x)
{
return! ((~(~0U>>1)|x)&x -1) ;
}
#ifdef TEST
int main(void)
{
int i;
for (i = 0; i < 256; ++i)
printf("%3d: %d\n", i, ispow2(i));
return 0;
}
#endif /* TEST */